#encoding:utf8
import os
import time
from datetime import datetime

filename = "test.d"


def start():
    fp = open(filename, 'a+')
    cnt = 0
    while 1:
        print >>fp, datetime.now()
        fp.flush()
        time.sleep(1)
        cnt += 1
        if cnt > 3:
            break
    print >>fp, "done ..... "

start()
